import request from '@/utils/request'

// 获取所有角色列表
export const getRoleList = (params) => {
  return request({
    url: '/sys/role',
    params
  })
}
// 根据id查询企业
export const getCompanyInfo = (companyId) => {
  return request({
    url: `/company/${companyId}`
  })
}
// 根据ID删除角色
export const deleteRole = (id) => {
  return request({
    url: `/sys/role/${id}`,
    method: 'DELETE'
  })
}
// 根据ID更新角色
export const updateRole = (data) => {
  return request({
    url: `/sys/role/${data.id}`,
    method: 'PUT',
    data
  })
}
// 根据ID获取角色详情
export const getRoleDetail = (id) => {
  return request({
    url: `/sys/role/${id}`
  })
}
// 添加角色
export const addRole = (data) => {
  return request({
    url: '/sys/role',
    method: 'POST',
    data
  })
}
// 给角色分配权限
export const assignPerm = (data) => {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
